<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>边距塌陷问题</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .box {
        width: 100px;
        height: 100px;
        background-color: bisque;
        border: 1px solid transparent;
      }
      .m-b-40 {
        margin-bottom: 40px;
      }
      .m-t-30 {
        margin-top: 30px;
      }
      .sub-box {
        width: 50px;
        height: 50px;
        background-color: aquamarine;
      }
      .bfc-container {
        display: inline-block;
      }

      .parent {
        border: 1px solid #ccc;
      }
      .overflow-auto {
        overflow: auto;
      }
      .float-child {
        float: left;
        width: 100px;
        height: 100px;
        background-color: aquamarine;
      }
      .child {
        width: 100px;
        height: 100px;
        background-color: orange;
      }

      .content {
        height: 200px;
        width: 200px;
        background-color: orange;
        border: 2px solid blue;
      }

      /* .parent::after {
        content: "";
        display: block;
        clear: both;
      } */
    </style>
  </head>
  <body>
    <div class="box m-b-40"></div>
    <div class="bfc-container">
      <div class="box m-t-30"></div>
    </div>

    <!-- <div class="box">
      <div class="sub-box m-t-30"></div>
    </div> -->

    <div class="parent">
      <div class="float-child">浮动元素</div>
    </div>

    <div class="parent overflow-auto">
      <div class="float-child">浮动元素</div>
    </div>

    <div class="parent">
      <div class="float-child">浮动元素</div>
      <div class="child overflow-auto">非浮动右侧元素</div>
    </div>

    <div class="parent">
      <div class="float-child">浮动元素</div>
      <div class="content overflow-auto">
        这是一段文本内容，它会环绕在浮动元素的周围。这是一段文本内容，它会环绕在浮动元素的周围。
      </div>
    </div>

    <!-- <div class="parent">
      <div class="float-child"></div>
    </div> -->
  </body>
</html>
